#include "ThreadPool.hpp"

#include <unistd.h>

#include <memory>
#include <functional>
#include <iostream>
using std::cout;
using std::endl;
using std::unique_ptr;

class MyTask{
public:
    void process(){
        srand(time(nullptr));
        printf("produce %d \n", rand()%100);
        //sleep(1);
    }    
};


int main()
{
    wd::ThreadPool threadpool(3,10);
    threadpool.start();


    for(int i = 0;i < 20 ;++i){
       threadpool.addTask(std::bind(&MyTask::process,MyTask()));
       printf("main : add %d task\n", i);
    }

    printf("before stop \n");
    threadpool.stop();

    return 0;

}

